﻿using CleanArchitecture.Infrastructure.Entities.Business;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CleanArchitecture.Infrastructure.DataMapping.Business
{
    public partial class ColumnMap : NowaEntityTypeConfiguration<Column>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<Column> builder)
        {
            builder.ToTable("bus_column");
            builder.HasKey(column => column.Id);
            builder.Property(column => column.FKLanguageId).HasColumnName("FK_LanguageId");
            builder.Property(column => column.MetaKeyWords).HasMaxLength(1000);
            builder.Property(column => column.MetaDescription).HasMaxLength(1000);
            builder.Property(column => column.MetaTitle).HasMaxLength(1000);
            builder.Property(column => column.DisplayName).HasMaxLength(255).IsRequired();
            builder.Property(column => column.SubTitle).HasMaxLength(255);
            builder.Property(column => column.IconImageUrl).HasMaxLength(1000);
            builder.Property(column => column.CoverImageUrl).HasMaxLength(1000);
            builder.Property(column => column.UrlRoute).HasMaxLength(1000).IsRequired();
            builder.Property(column => column.PageSizeOptions).HasMaxLength(200).IsRequired();
            builder.Property(column => column.LayoutListTemplate).HasMaxLength(100).IsRequired();
            builder.Property(column => column.LayoutDetailTemplate).HasMaxLength(100).IsRequired();

            //builder.HasOne(column => column.Language)
            //    .WithMany()
            //    .HasForeignKey(column => column.FKLanguageId)
            //    .IsRequired();

            base.Configure(builder);
        }

        #endregion
    }
}
